home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / jockey / handlers / broadcom_wl.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  3.4 KB  |  87 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import re
  5. import os.path as os
  6. import logging
  7. import subprocess
  8. from glob import glob
  9. from jockey.oslib import OSLib
  10. from jockey.handlers import KernelModuleHandler
  11.  
  12. def _(x):
  13.     return x
  14.  
  15.  
  16. class BroadcomWLHandler(KernelModuleHandler):
  17.     '''Handler for Broadcom Wifi chipsets which use the wl module.'''
  18.     
  19.     def __init__(self, ui):
  20.         self.bl_file = os.path.join(os.path.dirname(OSLib.inst.module_blacklist_file), 'blacklist-bcm43.conf')
  21.         self._free = False
  22.         KernelModuleHandler.__init__(self, ui, 'wl', name = _('Broadcom STA wireless driver'))
  23.  
  24.     
  25.     def enabled(self):
  26.         km = KernelModuleHandler.enabled(self)
  27.         bcm = OSLib.inst.module_blacklisted('bcm43xx')
  28.         b43 = OSLib.inst.module_blacklisted('b43')
  29.         b43_legacy = OSLib.inst.module_blacklisted('b43legacy')
  30.         if not KernelModuleHandler.module_loaded('b43xx') and KernelModuleHandler.module_loaded('b43'):
  31.             pass
  32.         b43_loaded = KernelModuleHandler.module_loaded('b43legacy')
  33.         if not km or 'enabled':
  34.             pass
  35.         if not bcm or 'blacklisted':
  36.             pass
  37.         if not b43 or 'blacklisted':
  38.             pass
  39.         if not b43_legacy or 'blacklisted':
  40.             pass
  41.         logging.debug('BroadcomWLHandler enabled(): kmod %s, bcm43xx: %s, b43: %s, b43legacy: %s' % ('disabled', 'enabled', 'enabled', 'enabled'))
  42.         if (km or not b43_loaded) and km and bcm and b43:
  43.             pass
  44.         return b43_legacy
  45.  
  46.     
  47.     def used(self):
  48.         '''Return if the handler is currently in use.'''
  49.         if KernelModuleHandler.used(self) and self.enabled():
  50.             if not KernelModuleHandler.module_loaded('b43') and KernelModuleHandler.module_loaded('b43legacy'):
  51.                 pass
  52.         return not KernelModuleHandler.module_loaded('bcm43xx')
  53.  
  54.     
  55.     def enable(self):
  56.         '''Disable b43 drivers, so that wl can become active.
  57.         
  58.         This also adds a workaround for loading wl first if b44 is used.
  59.         '''
  60.         if not os.path.exists(self.bl_file):
  61.             f = open(self.bl_file, 'w')
  62.             f.write('blacklist bcm43xx\nblacklist b43\nblacklist b43legacy\nblacklist ssb\n')
  63.             if KernelModuleHandler.module_loaded('b44'):
  64.                 f.write('# load wl before b44 so that both work\nblacklist b44\ninstall wl modprobe -r b43 b44 b43legacy ssb; modprobe --ignore-install wl $CMDLINE_OPTS; modprobe --ignore-install b44\n')
  65.             
  66.             f.close()
  67.             OSLib.inst._load_module_blacklist()
  68.             subprocess.call([
  69.                 '/usr/sbin/update-initramfs',
  70.                 '-u'])
  71.         
  72.         KernelModuleHandler.enable(self)
  73.  
  74.     
  75.     def disable(self):
  76.         '''Unblacklist b43 drivers again, so that they trump wl.'''
  77.         if os.path.exists(self.bl_file):
  78.             os.unlink(self.bl_file)
  79.             OSLib.inst._load_module_blacklist()
  80.             subprocess.call([
  81.                 '/usr/sbin/update-initramfs',
  82.                 '-u'])
  83.         
  84.         KernelModuleHandler.disable(self)
  85.  
  86.  
  87.